<!--
 * @Descripttion: 
 * @version: 
 * @Author: Connor
 * @Date: 2021-04-14 15:18:11
 * @LastEditors: Connor
 * @LastEditTime: 2021-04-14 16:36:25
-->
<template>
  <div >
        <el-row class="appraised-row">
            <el-col :span="2">服务态度</el-col>
            <el-col :span="22">
              <el-rate
                v-model="appraisedForm.scoreGrade"
                disabled
                show-text
                :texts="texts"
                text-color="#ff9900"
                score-template="{appraisedForm.scoreGrade}"
              />
            </el-col>
        </el-row>
        <el-row class="appraised-row">
            <el-col :span="2">提货时效</el-col>
            <el-col :span="22">
             <el-rate
                v-model="appraisedForm.scoreTakeDeliveryOfGood"
                disabled
                show-text
                :texts="texts"
                text-color="#ff9900"
                score-template="{appraisedForm.scoreTakeDeliveryOfGood}">
                </el-rate>
            </el-col>
        </el-row>
        <el-row class="appraised-row">
            <template v-for="(item, value) in appraiseList">
              <el-button
                :key="value"
                type="warning"
                size="small"
              >
                {{ item }}
              </el-button>
            </template>
        </el-row>
         <el-row class="appraised-row">
            <el-input
              v-model="appraisedForm.appraisedContent"
              type="textarea"
              autocomplete="off"
            />
          </el-row>
  </div>
</template>
<script>
import {ajax} from "@/store/yg/common/utils";
export default {
    props: ["field","data"],
    data() {
        return {
            value:5,
            appraisedForm:{
                scoreGrade:0,
                scoreTakeDeliveryOfGood:0,
                appraisedLabel:[],
                appraisedContent:"",
            },
            texts: [
                '非常不满意，各方面都差',
                '不满意，比较差',
                '一般，还需改善',
                '比较满意，仍可改善',
                '非常满意，无可挑剔'
            ],
            appraiseList:[],
        };
    },
    mounted() {
        this.driversWaybillNo();
    }, 
    methods: {
        driversWaybillNo() {
            this.appraisedForm = this.$store.state.edit.row;
            console.log(this.$store.state.edit.row.appraisedLabel);
            if(this.$store.state.edit.row.appraisedLabel){
                this.appraisedForm.appraisedLabel =  this.$store.state.edit.row.appraisedLabel.split(",");
            }
            ajax("appraisedLabelTypeSource", {}).then( res => {
                  //console.log(res);
                  for (const key in res.appraisedLabelSource) {
                      if(this.appraisedForm.appraisedLabel) {
                        this.appraisedForm.appraisedLabel.forEach(element => {
                            if(key === element) {
                                this.appraiseList.push(res.appraisedLabelSource[key]);
                            }
                        });
                      }
                  }
              },  error => {
                console.log(error);
              }
            );
        },
      }
}
</script>
<style scoped>

</style>

<style lang="scss">
.row-item {
  color: #3f4652;
  line-height: 28px;
  margin-bottom: 14px;
}
.appraised-row {
  padding: 5px 5px 5px 20px;
  text-align: left;
}
  
</style>
